<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?>

		<div id="container">
			<div id="content" role="main">
				<div class="main-slider">
					<?php
						Hope_Custom_functions :: show_home_slider();
					?>
				</div>
				<?php
				Hope_Custom_functions :: show_best_of_blog();
				/* Run the loop to output the posts.
				 */
				 $count = 0;
				?>
				<div class="clear"></div>
				<h3 class="home-bar-title"><span>RECENT POSTS</span></h3>
				<ul class="home-list-posts">
					<?php
					if(have_posts()) : while(have_posts()) : the_post(); global $post;$count++;
					?>
					<li class="home-blog-item <?php if($count == 3) echo " home-blog-item-no-margin" ;if($count%4==1&&$count!=1) echo " no-margin-right" ?>">
						<div class="post-item">
							<div class="post-item-content">
								<?php $cats = get_the_category($post->ID); ?>
								<p class="cat-list <?php echo strtoupper($cats[0]->name); ?>"><?php echo $cats[0]->name;?></p>
								<div class="clear"></div>
								<a class="thumbnail" href="<?php the_permalink() ; ?>"><?php	
									the_post_thumbnail('mainsize',array('title'=>get_the_title($post->ID), 'alt'=>get_the_title($post->ID)));	
								?>
								</a>
								<p class="post-descript"><strong class="subject"><?php echo get_post_meta($post->ID, 'title_description_post', true);?></strong><span class="des-content"><?php echo get_post_meta($post->ID, 'content_description_post', true);?></span></p>
								<h3 class="post-title"><a href="<?php the_permalink() ; ?>"><?php echo substr(get_the_title($post->ID),0,30)."..." ; ?></a></h3>
								<div class="short-content"><?php Hope_Custom_functions :: the_excerpt_max_charlength(90,$post) ; ?></div>
							</div>
						</div>
					</li>
					<?php
						if($count == 3)
						{ Hope_Custom_functions :: show_world_view();
						echo "<div class='clear'></div>";
						Hope_Custom_functions :: show_humor_me();	
						}
						if($count == 9)
						Hope_Custom_functions :: show_video();
					?>
					<?php
					endwhile;
					endif;				
					?>
				</ul>
				<div class="clear"></div>
				<ul class="home-list-posts load_more_content">
					
				</ul>
				<div class="clear"></div>
				<div class="load-more"><a href="javascript:void(0);"><img src="<?php bloginfo('template_directory');?>/images/loadmore.png" title="load more" alt="load more" /></a></div>
				<script type="text/javascript">
					jQuery(function(){
						jQuery('.load-more a').click(function(){						
							jQuery.ajax({
								type : 'POST',
								url : '<?php echo admin_url('admin-ajax.php') ; ?>',
								data : {action : 'load_more'},
								success : function(respone){
									jQuery('ul.load_more_content').html(respone);
									jQuery('.load-more').hide();
								}
							});
						});
					})
				</script>
			</div><!-- #content -->
		</div><!-- #container -->
<?php get_footer(); ?>
